var gulp=require("gulp");
var concat=require("gulp-concat");
var uglify=require("gulp-uglify");
var plumber=require("gulp-plumber");
var mincss=require("gulp-minify-css");
gulp.task("copy-index",["common-css","font","common-img"],function(){//,["css","jsuglify"]
	gulp.src("www/index.html").pipe(gulp.dest("dist"));
})
gulp.task("uglify-js",function(){
	gulp.src(["www/lib/ionic.bundle.min.js","www/lib/jquery-1.11.0.js","www/js/main.js","www/js/service/Location_ser.js","www/js/common.js","www/js/controller/timeCtr.js","www/js/controller/selectLocationCtr.js"])
	.pipe(concat("common.js"))
	.pipe(plumber("common.js"))
	.pipe(uglify("common.js"))
	.pipe(gulp.dest("dist/js"));
})
gulp.task("common-css",function(){
	gulp.src("www/css/*.css")
	.pipe(concat("common.css"))
	.pipe(mincss("common.css"))
	.pipe(gulp.dest("dist/css"));
})
gulp.task("common-img",function(){
	gulp.src(["www/images/*.ico","www/images/*.gif"])
//	.pipe(concat("common.css"))
//	.pipe(mincss("common.css"))
	.pipe(gulp.dest("dist/images"));
})
gulp.task("font",function(){
	gulp.src("www/font/*.ttf")
	.pipe(gulp.dest("dist/font"));
})
gulp.task("default",["copy-index","uglify-js"]);